<?php
namespace app\common\model;

use think\Model;

/**  YSF
 *   文章分类模型
 *   Date: 2019/1/23
 * Class ArticleCateModel
 * @package app\common\model
 */
class ArticleCateModel extends Model
{
    // 表名
    protected $name = 'article_cate';
    protected $dateFormat = false;

    // 单表列表查询
    public function getAll($where=[],$field='*',$page=1,$pageSize=999,$order='')
    {
        $result = $this->where($where)
                    ->field($field)
                    ->page($page, $pageSize)
                    ->order($order)
                    ->select();
        return $result;
    }

    // 单表数量查询
    public function getCount($where=[])
    {
        $result = $this->where($where)
                    ->count();
        return $result;
    }

    // 单表单条查询
    public function getOne($where=[],$field='*')
    {
        $result = $this->where($where)->field($field)->find();
        return $result;
    }

    // 添加操作
    public function add($data=[])
    {
        $result = $this->allowField(true)->insertGetId($data);
        return $result;
    }

    // 编辑操作
    public function edit($where=[],$data=[])
    {
        $result = $this->where($where)->update($data);
        return $result;
    }




}